﻿

using DAL;
using IDAL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DalFactory
{
	public partial class dbSessionStatic : IdbSession
	{
		public CodeFirstTestMvcDBEntities db
		{
			get
			{
				return new CodeFirstTestMvcDBEntities();
			}
		}
		public bool allSaveChangge()
		{
			return db.SaveChanges() > 0;
		}

		private IActionInfoDal _ActionInfoDal;
		public IActionInfoDal ActionInfoDal
		{
			get
			{
				if (_ActionInfoDal == null)
				{
					// _ActionInfo.csDal = new ActionInfo.csDal();
					_ActionInfoDal = AbstractFactory.CreateActionInfoStaticDal();
				}
				return _ActionInfoDal;
			}
			set { _ActionInfoDal = value; }
		}

		private IDepartmentDal _DepartmentDal;
		public IDepartmentDal DepartmentDal
		{
			get
			{
				if (_DepartmentDal == null)
				{
					// _Department.csDal = new Department.csDal();
					_DepartmentDal = AbstractFactory.CreateDepartmentStaticDal();
				}
				return _DepartmentDal;
			}
			set { _DepartmentDal = value; }
		}

		private IDepartmentUserMapperDal _DepartmentUserMapperDal;
		public IDepartmentUserMapperDal DepartmentUserMapperDal
		{
			get
			{
				if (_DepartmentUserMapperDal == null)
				{
					// _DepartmentUserMapper.csDal = new DepartmentUserMapper.csDal();
					_DepartmentUserMapperDal = AbstractFactory.CreateDepartmentUserMapperStaticDal();
				}
				return _DepartmentUserMapperDal;
			}
			set { _DepartmentUserMapperDal = value; }
		}

		private IRoleActionMapperDal _RoleActionMapperDal;
		public IRoleActionMapperDal RoleActionMapperDal
		{
			get
			{
				if (_RoleActionMapperDal == null)
				{
					// _RoleActionMapper.csDal = new RoleActionMapper.csDal();
					_RoleActionMapperDal = AbstractFactory.CreateRoleActionMapperStaticDal();
				}
				return _RoleActionMapperDal;
			}
			set { _RoleActionMapperDal = value; }
		}

		private IRoleInfoDal _RoleInfoDal;
		public IRoleInfoDal RoleInfoDal
		{
			get
			{
				if (_RoleInfoDal == null)
				{
					// _RoleInfo.csDal = new RoleInfo.csDal();
					_RoleInfoDal = AbstractFactory.CreateRoleInfoStaticDal();
				}
				return _RoleInfoDal;
			}
			set { _RoleInfoDal = value; }
		}

		private IUserActionMapperDal _UserActionMapperDal;
		public IUserActionMapperDal UserActionMapperDal
		{
			get
			{
				if (_UserActionMapperDal == null)
				{
					// _UserActionMapper.csDal = new UserActionMapper.csDal();
					_UserActionMapperDal = AbstractFactory.CreateUserActionMapperStaticDal();
				}
				return _UserActionMapperDal;
			}
			set { _UserActionMapperDal = value; }
		}

		private IUserInfoDal _UserInfoDal;
		public IUserInfoDal UserInfoDal
		{
			get
			{
				if (_UserInfoDal == null)
				{
					// _UserInfo.csDal = new UserInfo.csDal();
					_UserInfoDal = AbstractFactory.CreateUserInfoStaticDal();
				}
				return _UserInfoDal;
			}
			set { _UserInfoDal = value; }
		}

		private IUserRoleMapperDal _UserRoleMapperDal;
		public IUserRoleMapperDal UserRoleMapperDal
		{
			get
			{
				if (_UserRoleMapperDal == null)
				{
					// _UserRoleMapper.csDal = new UserRoleMapper.csDal();
					_UserRoleMapperDal = AbstractFactory.CreateUserRoleMapperStaticDal();
				}
				return _UserRoleMapperDal;
			}
			set { _UserRoleMapperDal = value; }
		}
	}
}